/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小梅就是酱子
 * Date: 2022-01-26
 * Time: 18:30
 */
public class 递归求1一直到10的和 {
    public static void main(String[] args) {
        System.out.println(sum(10));
    }
    public static int sum(int n){
        if(n==1){
            return 1;
        }
        return n+sum(n-1);
    }
}
